package org.zxl.provider.h3c.version_base.platform;

import org.zxl.api.common.dto.CloudRequestEntity;
import org.zxl.api.common.dto.CloudResponseEntity;
import org.zxl.api.common.util.HttpClient;
import org.zxl.api.platform.dto.AuthInfo;
import org.zxl.api.platform.dto.LoginReqDTO;
import org.zxl.api.platform.service.PlatformService;
import org.zxl.provider.h3c.H3CConstants;
import org.zxl.provider.h3c.version_base.handler.CheckAuthFailExceptionHandlerH3CVersionBase;
import org.zxl.provider.h3c.version_base.handler.HttpHeaderBuilderH3CVersionBase;
import org.zxl.provider.h3c.version_base.handler.HttpResponseParseH3CVersionBase;

/**
 * @author zhangxiaolong
 * @date 2025-02-18 10:41
 **/
public class PlatformServiceH3CVersionBase implements PlatformService {

    @Override
    public String name() {
        return H3CConstants.PLATFORM_NAME;
    }

    @Override
    public String version() {
        return "";
    }

    @Override
    public CloudResponseEntity<AuthInfo> loginReal(CloudRequestEntity<LoginReqDTO> loginReq) {
        System.out.println("PlatformServiceH3CVersionBase loginReal");
        HttpClient httpClient = new HttpClient();
        AuthInfo authInfo = httpClient.get("", "",
                new HttpHeaderBuilderH3CVersionBase(),
                new HttpResponseParseH3CVersionBase(),
                new CheckAuthFailExceptionHandlerH3CVersionBase(), AuthInfo.class, "");
        return CloudResponseEntity.success(authInfo);
    }
}
